package com.yuke.cloud.service.pmc.service.impl;

import com.yuke.cloud.service.pmc.dao.ProdFactoryPictureMapper;
import com.yuke.cloud.service.pmc.entity.ProdFactoryPicture;
import com.yuke.cloud.service.pmc.service.ProdFactoryPictureService;
import com.yuke.cloud.common.core.support.BaseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;


/**
 * Created by zys on 2018/09/28.
 */
@Service
@Transactional
public class ProdFactoryPictureServiceImpl extends BaseService<ProdFactoryPicture> implements ProdFactoryPictureService {
    @Resource
    private ProdFactoryPictureMapper prodFactoryPictureMapper;

    @Override
    public int save(ProdFactoryPicture record) {
        record.setFactoryPictureId(generateId());
        return super.save(record);
    }

    //    @Resource
//    private HandlerFileService handlerFileService;

//    @Override
//    public void deleteById(Long id) {
//        String bigPath = handlerFileService.getGallerPath() + prodFactoryPictureMapper.selectByPrimaryKey(id).getBigPicUri();
//        String smallPath = handlerFileService.getGallerPath() + prodFactoryPictureMapper.selectByPrimaryKey(id).getSmallPicUri();
//        int flat = prodFactoryPictureMapper.deleteByPrimaryKey(id);
//        if (flat > 0) {
//            handlerFileService.deleteFile(bigPath);
//            handlerFileService.deleteFile(smallPath);
//        }
//    }
}
